﻿using System;
using UnityEngine;

namespace UniRx.Triggers
{
	// Token: 0x0200042A RID: 1066
	[DisallowMultipleComponent]
	public class ObservableCollision2DTrigger : ObservableTriggerBase
	{
		// Token: 0x0600163C RID: 5692 RVA: 0x00061318 File Offset: 0x0005F718
		private void OnCollisionEnter2D(Collision2D coll)
		{
			if (this.onCollisionEnter2D != null)
			{
				this.onCollisionEnter2D.OnNext(coll);
			}
		}

		// Token: 0x0600163D RID: 5693 RVA: 0x00061334 File Offset: 0x0005F734
		public IObservable<Collision2D> OnCollisionEnter2DAsObservable()
		{
			Subject<Collision2D> result;
			if ((result = this.onCollisionEnter2D) == null)
			{
				result = (this.onCollisionEnter2D = new Subject<Collision2D>());
			}
			return result;
		}

		// Token: 0x0600163E RID: 5694 RVA: 0x0006135C File Offset: 0x0005F75C
		private void OnCollisionExit2D(Collision2D coll)
		{
			if (this.onCollisionExit2D != null)
			{
				this.onCollisionExit2D.OnNext(coll);
			}
		}

		// Token: 0x0600163F RID: 5695 RVA: 0x00061378 File Offset: 0x0005F778
		public IObservable<Collision2D> OnCollisionExit2DAsObservable()
		{
			Subject<Collision2D> result;
			if ((result = this.onCollisionExit2D) == null)
			{
				result = (this.onCollisionExit2D = new Subject<Collision2D>());
			}
			return result;
		}

		// Token: 0x06001640 RID: 5696 RVA: 0x000613A0 File Offset: 0x0005F7A0
		private void OnCollisionStay2D(Collision2D coll)
		{
			if (this.onCollisionStay2D != null)
			{
				this.onCollisionStay2D.OnNext(coll);
			}
		}

		// Token: 0x06001641 RID: 5697 RVA: 0x000613BC File Offset: 0x0005F7BC
		public IObservable<Collision2D> OnCollisionStay2DAsObservable()
		{
			Subject<Collision2D> result;
			if ((result = this.onCollisionStay2D) == null)
			{
				result = (this.onCollisionStay2D = new Subject<Collision2D>());
			}
			return result;
		}

		// Token: 0x06001642 RID: 5698 RVA: 0x000613E4 File Offset: 0x0005F7E4
		protected override void RaiseOnCompletedOnDestroy()
		{
			if (this.onCollisionEnter2D != null)
			{
				this.onCollisionEnter2D.OnCompleted();
			}
			if (this.onCollisionExit2D != null)
			{
				this.onCollisionExit2D.OnCompleted();
			}
			if (this.onCollisionStay2D != null)
			{
				this.onCollisionStay2D.OnCompleted();
			}
		}

		// Token: 0x04000C8B RID: 3211
		private Subject<Collision2D> onCollisionEnter2D;

		// Token: 0x04000C8C RID: 3212
		private Subject<Collision2D> onCollisionExit2D;

		// Token: 0x04000C8D RID: 3213
		private Subject<Collision2D> onCollisionStay2D;
	}
}
